<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="js/jquery-1.12.4.js"></script>
    <script type="text/javascript">
        $(function () {
            var $li = $('.list li');
            alert($li.length);
            /* alert($li.eq(3).index());  弹出3*/
            alert($li.filter('.myli').index());


        });
    </script>
    <title>Document</title>
</head>

<body>
    <ul class="list">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li class="myli">5</li>
        <li>6</li>
        <li>7</li>
        <li>8</li>
    </ul>

</body>

</html>